{% extends "bash.html" %}

{% block bar %}
    <div class="col-md-9" style="justify-content:flex-end;">
        <h1 class="page-header">图书管理页面</h1>
        <div class="panel panel-primary">
            <!-- Default panel contents -->
            <div class="panel-heading">图书列表<i class="fa fa-thumb-tack pull-right"></i></div>
            <div class="panel-body">
                <div class="row" style="margin-bottom: 15px">
                    <div class="col-md-4">
                        <div class="input-group">
                            <input type="text" class="form-control" placeholder="Search for...">
                            <span class=" input-group-btn">
                        <button class="btn btn-default" type="button">搜索</button></span>
                        </div><!--/input-group--></div>
                    <!--/.col-md-4-->
                    <div class="col-md-2 pull-right">
                        <a class="btn btn-success" href="/app01/add_book/">新增图书</a>
                    </div>
                </div>
            </div>

            {% block main %}
                <table border="1" class="table table-hover table-bordered">
                    <thead>
                    <tr>
                        <th>序号</th>
                        <th>图书id</th>
                        <th>图书名</th>
                        <th>价格</th>
                        <th>库存</th>
                        <th>卖出数</th>
                        <th>出版社</th>
                        <th>操作</th>
                    </tr>
                    </thead>
                    <tbody>
                    {% for book_obj in book_obj_list %}
                        <tr>
                            <td>{{ forloop.counter }}</td>
                            <td>{{ book_obj.id }}</td>
                            <td>{{ book_obj.name }}</td>
                            <td>{{ book_obj.price }}</td>
                            <td>{{ book_obj.inventory }}</td>
                            <td>{{ book_obj.sale_num }}</td>'
                            <td>{{ book_obj.publisher.name }}</td>
                            <td>
                                <a href="/app01/edit_book/?id={{ book_obj.id }}">修改</a>
                                <a href="/app01/delete_book/?id={{ book_obj.id }}">删除</a>
                            </td>
                        </tr>
                    {% endfor %}
                    </tbody>
                </table>

            {% endblock %}
            <!-- 页码-->
            <nav aria-label="Page navigation">
                <ul class="pagination">
                    <li>
                        <a href="#" aria-label="Previous">
                            <span aria-hidden="true">&laquo;</span>
                        </a>
                    </li>
                    <li><a href="#">1</a></li>
                    <li><a href="#">2</a></li>
                    <li><a href="#">3</a></li>
                    <li><a href="#">4</a></li>
                    <li>
                        <a href="#" aria-label="Next">
                            <span aria-hidden="true">&raquo;</span>
                        </a>
                    </li>
                </ul>
            </nav>
        </div>
    </div>
{% endblock %}
